package com.in.mobilerechargedth.adapter;

import java.util.List;

import com.in.mobilerechargedth.model.OperatorModel;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class SpinnerOperatorAdapter extends BaseAdapter {

    private Context context;
    private List<OperatorModel> items;

    public SpinnerOperatorAdapter(Context context, List<OperatorModel> items) {
        super();
        // TODO Auto-generated constructor stub
        this.context = context;
        this.items = items;
    }

    @Override
    public int getCount() {
        // TODO Auto-generated method stub
        return items.size();
    }

    @Override
    public OperatorModel getItem(int position) {
        // TODO Auto-generated method stub
        return items.get(position);
    }

    @Override
    public long getItemId(int position) {
        // TODO Auto-generated method stub
        return this.items.get(position).getOperatorId();
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        // TODO Auto-generated method stub
        TextView label = new TextView(context);
        label.setTextSize(16);
        label.setText(items.get(position).geOperatorName());

        return label;
    }

    @Override
    public View getDropDownView(int position, View convertView, ViewGroup parent) {
        // TODO Auto-generated method stub
        TextView label = new TextView(context);
        label.setTextSize(16);
        label.setPadding(15, 30, 15, 30);
        label.setText(items.get(position).geOperatorName());

        return label;
    }
}
